<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        p {
            display: flex;
        }

        span {
            width: 100px;
            border: 1px solid #000;
            text-align: center;
            line-height: 40px;
            margin: 10px;
        }
    </style>
</head>

<body>

    <!-- <p>
        <span>1x1=1</span>
    </p>
    <p>
        <span>1*2=2</span>
        <span>2*2=4</span>
    </p> -->

    <script>

        // 把标签当做字符串来看



        for (var i = 1; i <= 9; i++) {   //  行数
            document.write('<p>');
            for (var j = 1; j <= i; j++) {    // span的个数
                document.write('<span>' + j + 'x' + i + '=' + i * j + '</span>');
            }
            document.write('</p>');
        }

    </script>

</body>

</html>